package com.cyh.testcustomui;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class LetterSideBarActivity extends AppCompatActivity {

    TextView tv_letter;
    LetterSideBar lsb_bar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_letter_side_bar);
        tv_letter = findViewById(R.id.tv_letter);
        lsb_bar = findViewById(R.id.lsb_bar);
        lsb_bar.setmCrrentTouchLetter(new LetterSideBar.LetterTouchListener() {
            @Override
            public void hide() {
                tv_letter.setVisibility(View.GONE);
            }

            @Override
            public void touch(String letter) {
                if(tv_letter.getVisibility() == View.GONE) {
                    tv_letter.setVisibility(View.VISIBLE);
                }
                tv_letter.setText(letter);
            }
        });
    }
}
